import { apiGet, apiPost } from './api'

//获取新闻列表
export const getNewslist = (query) => {
  return new Promise((resolve, reject) => {
    apiPost('https://goods.zzgoodqc.cn/index.php/index/News/newsList', query)
      .then((res) => {
        resolve(res)
      })
      .catch((err) => {
        reject(err)
      })
  })
}

//添加新闻
export const addTableList = (query) => {
  return new Promise((resolve, reject) => {
    apiPost('https://goods.zzgoodqc.cn/index.php/index/News/addNews', query)
      .then((res) => {
        resolve(res)
      })
      .catch((err) => {
        reject(err)
      })
  })
}
//删除新闻
export const delTableList = (query) => {
  return new Promise((resolve, reject) => {
    apiGet('https://goods.zzgoodqc.cn/index.php/index/News/delNews', query)
      .then((res) => {
        resolve(res)
      })
      .catch((err) => {
        reject(err)
      })
  })
}
//查看详情

export const newsInfo = (query) => {
  return new Promise((resolve, reject) => {
    apiPost('https://goods.zzgoodqc.cn/index.php/index/News/getNewsByid', query)
      .then((res) => {
        resolve(res)
      })
      .catch((err) => {
        reject(err)
      })
  })
}
